/*
 * @Descripttion: 
 * @version: 
 * @Author: dudu
 * @Date: 2020-08-12 11:33:58
 * @LastEditors: dudu
 * @LastEditTime: 2020-08-14 14:38:54
 */
import { createComponentHelper } from '@components/QueryPanel/constant'



export const queryConfigMixins = {
  data () {
    return {
      queryConfig: {
        data: [
          createComponentHelper.autocomplete({
            key: 'custom',
            label: '客户',
            querySearchAsync: this.querySearchAsync('custom'),
            placeholder: '请输入客户名称',
            rules: [{
              reg: /./,
              message: '请输入客户名称'
            }]
          }),
          createComponentHelper.autocomplete({
            key: 'project',
            label: '项目',
            querySearchAsync: this.querySearchAsync('project'),
            placeholder: '请输入项目名称',
            rules: [{
              reg: /./,
              message: '请输入项目名称'
            }]
          }),
          createComponentHelper.select({
            key: 'priority',
            label: '项目优先级',
            options: [{
              code: 'low',
              name: '低'
            }, {
              code: 'middle',
              name: '中'
            }, {
              code: 'high',
              name: '高'
            }],
            placeholder: '请选择项目优先级',
            rules: [{
              reg: /./,
              message: '请输入项目名称'
            }]
          }),
          createComponentHelper.select(
            {
              key: 'status',
              label: '项目状态',
              options: [{
                code: 'unstart',
                name: '未开始'
              }, {
                code: 'progressing',
                name: '进行中'
              }, {
                code: 'finish',
                name: '已完成'
              }],
              placeholder: '请选择项目状态',
              rules: [{
                reg: /./,
                message: '请选择项目状态'
              }]
            }
          ),
          createComponentHelper.selectWithInput({
            key: 'hold',
            label: '项目把握度',
            children: [{
              type: 'select',
              options: [{
                code: 'lteq',
                name: '<='
              }, {
                code: 'lgeq',
                name: '>='
              }, {
                code: 'between',
                name: '介于'
              }],
              placeholder: '请选择',
              rules: [{
                reg: /./,
                message: '请选择关系'
              }]
            }, {
              type: 'input',
              rules: [{
                reg: /(^([1-9]{1}[0-9]{0,1})([.][0-9]{1,8})?$)|(^100$)|(0)|(^[0][.][1-9]{1,8})$/,
                message: '0-100之间的数值'
              }],
              placeholder: '请输入把握度'
            }],
            tip: '(0%-100%，以百分比为单位)'
          }),
          createComponentHelper.selectWithInput({
            key: 'account',
            label: '预计金额',
            children: [{
              type: 'select',
              options: [{
                code: 'lteq',
                name: '<='
              }, {
                code: 'lgeq',
                name: '>='
              }, {
                code: 'eq',
                name: '='
              }, {
                code: 'between',
                name: '介于'
              }],
              placeholder: '请选择',
              rules: [{
                reg: /./,
                message: '请选择关系'
              }]
            }, {
              type: 'input',
              placeholder: '请输入预计金额',
              rules: [{
                reg: /(^([1-9]{1}[0-9]{0,4})([.][0-9]{1,8})?$)|(^100000)|(0)|(^[0][.][1-9]{1,8})$/,
                message: '0-100000之间的数值'
              }]
            }],
            tip: '(0-10亿元，以万为单位)'
          }),
          createComponentHelper.datepicker({
            key: 'signDate',
            label: '预计签约时间',
            rules: [{
              reg: /./,
              message: '请输入预计签约时间'
            }]
          }),
          createComponentHelper.select(
            {
              key: 'person',
              label: '负责人',
              options: [{
                code: 'zhangsan',
                name: '张三'
              }, {
                code: 'lisi',
                name: '李四'
              }],
              placeholder: '请选择负责人',
              rules: [{
                reg: /./,
                message: '请选择负责人'
              }]
            }
          ),
        ]
      }

    }
  },
  created () {
    // 混入初始化配置
    this.baseConfig.queryConfig = this.queryConfig
  }
}
